Data Types

Predefined Data Types

C# provides 15 predefined types they include 13 simple types and 2 non-simple types.
The names of all the predefined types consist of all lowercase characters. The predefined
Simple types include the following:

A high-precision decimal type called decimal. Unlike float and double, type decimal can represent decimal fractional numbers exactly. It is often used for monetary calculations.

 Type bool represents Boolean values and must be one of two values—either true or false.

The two non-simple types are the following:

 

 

 

 

 

 

The predefined simple types with their lengths.

The Predefined Non-Simple Types

User-Defined Types
Besides the 15 predefined types provide by C#, you can also create your own types, called userdefined types.
There are six kinds of types you can create, as follows:

A declaration (name and specification) of each of the type’s members—except for array
and delegate types, which do not have named members Once you have declared a type, you can create and use objects of the type just as if they were predefined types. But whereas using predefined types is a one-step process in which you simply instantiate the objects, using user-defined types is a two-step process. You first declare the type and then instantiate objects of the type.